package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2021-10-28
 */
@Controller
@RequestMapping("/system/yuyue")
public class PageController extends BaseController
{
    private String prefix = "system/index";

    @GetMapping("/login") // 登录页面
    public String index()
    {
        return prefix + "/login";
    }

    @GetMapping("/index") // 选择页面
    public String select()
    {
        return prefix + "/index";
    }

    @GetMapping("/orderlist") // 预约页面
    public String orderlist()
    {
        return prefix + "/orderlist";
    }

    @GetMapping("/liuyanlist") // 留言页面
    public String liuyanlist()
    {
        return prefix + "/liuyanlist";
    }

    @GetMapping("/liuyan") // 留言填写
    public String liuyan()
    {
        return prefix + "/liuyan";
    }


    @GetMapping("/edit") // 填报页面
    public String edit()
    {
        return prefix + "/edit";
    }

    @PostMapping("/login")
    @ResponseBody
    public AjaxResult ajaxLogin(String name, String shoujihao, HttpServletRequest request) {
        name = name.trim();
        shoujihao = shoujihao.trim();

        HttpSession session = request.getSession();
        session.setAttribute("name", name);
        session.setAttribute("phone", shoujihao);

        return success();
    }
}
